import request from '@/config/axios'

export interface AgentUserVO {
  agentId: number
  agentParentId: number | undefined
  agentUserId: number | undefined
  agentLevelId: number | undefined
  agentName: string | undefined
  agentParentName?: string | undefined
  agentUserName?: string | undefined
}

// 查询代理用户列表
export const getBrokerageUserPage = async (params: any) => {
  return await request.get({ url: `/trade/brokerage-agent/page`, params })
}

// 新增代理用户
export const createBrokerageUser = async (data: AgentUserVO) => {
  return await request.post({ url: `/trade/brokerage-agent/create`, data })
}

// 修改代理用户
export const updateBrokerageUser = async (data: AgentUserVO) => {
  return await request.put({ url: `/trade/brokerage-agent/update`, data })
}
// 查询代理用户详情
export const getBrokerageUser = async (id: number) => {
  return await request.get({ url: `/trade/brokerage-agent/get?id=` + id })
}

// 修改推广员
export const updateBindUser = async (data: any) => {
  return await request.put({ url: `/trade/brokerage-agent/update-bind-user`, data })
}
// 删除代理等级
export const deleteAgent = async (id: number) => {
  return await request.delete({ url: `/trade/brokerage-agent/delete?id=` + id })
}
// 修改上级代理商
export const updateParentId = async (data: any) => {
  return await request.put({ url: `/trade/brokerage-agent/updateParentId`, data })
}
// 修改代理商账户
export const updateBanlance = async (data: any) => {
  return await request.put({ url: `/trade/brokerage-agent/updateBanlance`, data })
}
// 修改代理等级
export const updateLevel = async (data: any) => {
  return await request.put({ url: `/trade/brokerage-agent/updateLevel`, data })
}
// 修改代理状态
export const updateStatus = async (data: any) => {
  return await request.put({ url: `/trade/brokerage-agent/updateStatus`, data })
}
